package com.example.allshengmedical.experimentanalyze.activity;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import android.R.integer;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.OrientationHelper;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.LayoutManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;

import com.allsheng.dataprocess.AutoBaseline;
import com.allsheng.matrix.LeastSquareMethod;
import com.example.allshengmedical.R;
import com.example.allshengmedical.base.BaseActivity;
import com.example.allshengmedical.base.BaseApplication;
import com.example.allshengmedical.experimentanalyze.activity.AnalyzeAmplificationplotActivity.DragGridViewAdapter;
import com.example.allshengmedical.experimentanalyze.activity.AnalyzeAmplificationplotActivity.DragGridViewAdapter.ViewHolder;
import com.example.allshengmedical.experimentanalyze.presenter.AnalyzeStandardCurvePresenter;
import com.example.allshengmedical.experimentanalyze.view.IAnalyzeStandardCurveView;
import com.example.allshengmedical.experimentnew.bean.LayoutTableBean;
import com.example.allshengmedical.experimentnew.bean.MethodBean;
import com.example.allshengmedical.experimentrun.activity.AmplifucationActivity;
import com.example.allshengmedical.experimentrun.activity.RunMethodActivity;
import com.example.allshengmedical.experimentrun.activity.TemparetureActivity;
import com.example.allshengmedical.mainmenu.activity.MainMenuActivity;
import com.example.allshengmedical.util.ByAlert;
import com.example.allshengmedical.util.DragGridView;
import com.example.allshengmedical.util.LogUtil;
import com.example.allshengmedical.util.MathLog;
import com.example.allshengmedical.util.SharedPreferencesUtils;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.Legend.LegendForm;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;

//标准曲线界面
public class AnalyzeStandardCurveActivity extends BaseActivity implements IAnalyzeStandardCurveView {

	public final int TASK_LOOP_COMPLETE = 0;
	ProgressDialog pd;

	private AnalyzeStandardCurvePresenter analyzeStandardCurvePresenter;

	// spinner
	private ArrayList<String> data_list1;
	private Spinner spinner1;
	private ArrayAdapter<String> arr_adapter1;

	// bar
	private boolean menuboo;
	private PopupWindow menuPopupWindow;

	// lineChart
	LineChart chart;
	// 曲线
	private LineDataSet dataSet1;
	private LineDataSet dataSet2;
	private ArrayList<LineDataSet> dataSets;
	private ArrayList<String> xValues;

	// 数据
	String folderName;
	String fileName;
	private String appFilePath = Environment.getExternalStorageDirectory() + "/" + "AllShengMedical";
	StringBuffer contextString = new StringBuffer();

	// 基因盘数据
	public ArrayList<LayoutTableBean> activityLayoutTableBeans;

	// 基因盘
	private DragGridView dragGridView;
	private DragGridViewAdapter dragGridViewAdapter;
	private Button block1Btn, block2Btn;
	// private Boolean blockUpSwitchBoo1 = false, blockDownSwitchBoo1 = false;
	// private Boolean blockUpSwitchBoo2 = false, blockDownSwitchBoo2 = false;
	private String blockStr = "block1";
	private TextView blockUpTv, blockDownTv;
	// 基因盘数据
	public List<HashMap<String, Object>> dataSourceListBlock1 = new ArrayList<HashMap<String, Object>>();
	public List<HashMap<String, Object>> dataSourceListBlock2 = new ArrayList<HashMap<String, Object>>();
	public List<HashMap<String, Object>> dataSourceListBlockToShow = new ArrayList<HashMap<String, Object>>();

	private RecyclerView targetRv;
	private MyAdapter myAdapter;

	private RelativeLayout white_line;
	private LinearLayout main_line;

	AutoBaseline autoBaseline = new AutoBaseline();
	LeastSquareMethod myLeastSquareMethod = new LeastSquareMethod();

	// ct数据
	public HashMap<Integer, LineDataSet> dataListCTArrayList = new HashMap<Integer, LineDataSet>();

	public ArrayList<StandCurveBean> standCurveBeans;

	private ArrayList<String> colors;
	private HashMap<String, ArrayList<String>> hashMap;
	private HashMap<String, HashSet<String>> hashMap2;
	private ArrayList<Double> xValueAllArrayList;
	private HashMap<String, double[]> pxsHashMap;
	private HashMap<String, double[]> pysHashMap;
	private TextView clearTv, showTv;
	private LineDataSet redLineDataSet;
	Boolean showBoolean = true;
	LinearLayout blockLine, geneLine;

	// 曲线图
	// 上半部
	private ArrayList<MethodBean> activityMethodBeans = new ArrayList<MethodBean>();
	// 重复次数
	public int repititions;

	@Override
	protected int setcontent() {
		return R.layout.activity_analyze_standardcurve;
	}

	@Override
	protected void initView() {

		dragGridView.setDrag(false);
		// Intent intent = getIntent();
		// data_list1 = new ArrayList<String>();
		// data_list1 = intent.getStringArrayListExtra("data_list1");
		getInfo();
		initSpinner();
		analyzeStandardCurvePresenter = new AnalyzeStandardCurvePresenter(this);
		analyzeStandardCurvePresenter.initAppHead();
		if ("no".equals(
				SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this, BaseApplication.AnalyzeAmYESORNO, "")
						+ "")) {
			// 不能使用此页面
			white_line.setVisibility(View.VISIBLE);

//			return;
		} else {
			white_line.setVisibility(View.GONE);

		}
		analyzeStandardCurvePresenter.initBottomView();
		analyzeStandardCurvePresenter.initSpinnerView();
		analyzeStandardCurvePresenter.initInformation();

		analyzeStandardCurvePresenter.initLineChart();
		initDragGridView();

		targetRv = BindView(R.id.targetRv);
		LayoutManager layoutManager = new GridLayoutManager(this, 1);
		((GridLayoutManager) layoutManager).setOrientation(OrientationHelper.HORIZONTAL);
		targetRv.setLayoutManager(layoutManager);
		standCurveBeans = new ArrayList<StandCurveBean>();
		for (int i = 0; i < activityLayoutTableBeans.size(); i++) {

			standCurveBeans.add(new StandCurveBean(activityLayoutTableBeans.get(i).getTarget(), "", "", "", ""));

		}

		myAdapter = new MyAdapter(standCurveBeans);
		targetRv.setAdapter(myAdapter);
		CheckGene();

		clearTv.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				for (HashMap<String, Object> bean : dataSourceListBlock1) {
					bean.put("item_selected", false);
				}
				for (HashMap<String, Object> bean : dataSourceListBlock2) {
					bean.put("item_selected", false);
				}

				dragGridViewAdapter.notifyDataSetChanged();

				dataSets.clear();
				dataSets.add(redLineDataSet);

				LineData lineData = new LineData(xValues, dataSets);
				// mLineChart2.setBackgroundColor(Color.BLUE);
				chart.setGridBackgroundColor(Color.WHITE);
				// 将数据插入
				chart.setData(lineData);
				Legend mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);
				chart.animateX(0); // 立即执行的动画,x轴

			}
		});

		showTv.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (showBoolean) {
					blockLine.setVisibility(View.INVISIBLE);
					geneLine.setVisibility(View.INVISIBLE);
					clearTv.setVisibility(View.INVISIBLE);
					showTv.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
					showTv.setTextColor(Color.parseColor("#ffffff"));
				} else {
					blockLine.setVisibility(View.VISIBLE);
					geneLine.setVisibility(View.VISIBLE);
					clearTv.setVisibility(View.VISIBLE);
					showTv.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));
					showTv.setTextColor(Color.parseColor("#000000"));
				}
				showBoolean = !showBoolean;
			}
		});

	}

	/**
	 * 当进入这个页面判断是否存在stander数据的基因盘 然后再判断有几个不同的。一个继续不能使用
	 */

	private synchronized void CheckGene() {
		// dataListCTArrayList =
		// AnalyzeAmplificationplotActivity.getInstence().dataListCTArrayList;

		// getRepitions();
		AmplificationUtil amplificationUtil = new AmplificationUtil();
		amplificationUtil.getAnalySetting(AnalyzeStandardCurveActivity.this, dataSourceListBlock1, dataSourceListBlock2,
				AnalyzeAmplificationplotActivity.getInstence().repititions,
				AnalyzeAmplificationplotActivity.getInstence().dataListArrayList);
		dataListCTArrayList = amplificationUtil.getDataListCTArrayList();
		// 分别遍历两个基因盘数据

		// ArrayList<HashMap<String, ArrayList<String>>> targetGenenArrayList =
		// new ArrayList<HashMap<String, ArrayList<String>>>();

		colors = new ArrayList<String>();
		for (LayoutTableBean tableBean : activityLayoutTableBeans) {
			colors.add(tableBean.getColor() + "");
		}
		hashMap = new HashMap<String, ArrayList<String>>();
		hashMap2 = new HashMap<String, HashSet<String>>();
		for (int j = 0; j < colors.size(); j++) {

			ArrayList<String> strings = new ArrayList<String>();
			// 求个数用的,排除重复
			HashSet<String> Stringset = new HashSet<String>();

			for (int i = 0; i < 16; i++) {

				// ab
				if (dataSourceListBlock1.get(i).get("item_image").equals(colors.get(j))) {
					if ("standard".equals(dataSourceListBlock1.get(i).get("item_type"))) {
						strings.add(dataSourceListBlock1.get(i).get("item_text") + "");
						Stringset.add(dataSourceListBlock1.get(i).get("item_text") + "");
					}

				}
				// cd
				if (dataSourceListBlock2.get(i).get("item_image").equals(colors.get(j))) {
					if ("standard".equals(dataSourceListBlock2.get(i).get("item_type"))) {
						strings.add(dataSourceListBlock2.get(i).get("item_text") + "");
						Stringset.add(dataSourceListBlock2.get(i).get("item_text") + "");
					}

				}

			}

			hashMap.put(colors.get(j), strings);
			hashMap2.put(colors.get(j), Stringset);
		}

		//
		Boolean flag = false;
		for (int i = 0; i < colors.size(); i++) {
			if (hashMap2.get(colors.get(i)).size() > 1) {
				flag = true;
			}
		}

		if (flag) {
			// 可以使用此页面
			white_line.setVisibility(View.INVISIBLE);
			main_line.setVisibility(View.VISIBLE);
		} else {
			// 不能使用此页面
			white_line.setVisibility(View.VISIBLE);
			main_line.setVisibility(View.INVISIBLE);
			return;
		}

		for (int i = 0; i < colors.size(); i++) {
			if (hashMap2.get(colors.get(i)).size() == 1) {
				// 不能使用此页面
				white_line.setVisibility(View.VISIBLE);
				main_line.setVisibility(View.INVISIBLE);
				return;
			}
		}

		// 红点的x轴数据
		HashMap<String, ArrayList<Double>> xValuesDoubleSetHashMap = new HashMap<String, ArrayList<Double>>();

		// 加入红色standard点的x轴值

		for (int i = 0; i < colors.size(); i++) {
			ArrayList<Double> xValuesDouble = new ArrayList<Double>();
			for (String setString : hashMap2.get(colors.get(i))) {
				String linshiString = setString.substring(setString.indexOf("St.") + 3, setString.length());
				xValuesDouble
						.add(MathLog.log((float) (Float
								.parseFloat(linshiString.substring(0,
										linshiString.indexOf("E")))
						* (Math.pow(10, Integer.parseInt(
								linshiString.substring(linshiString.indexOf("E") + 1, linshiString.length()))))), 10));
			}
			xValuesDoubleSetHashMap.put(colors.get(i), xValuesDouble);
		}
		xValueAllArrayList = new ArrayList<Double>();

		for (int i = 0; i < colors.size(); i++) {
			if (xValuesDoubleSetHashMap.get(colors.get(i)).size() > 1) {
				xValueAllArrayList.addAll(xValuesDoubleSetHashMap.get(colors.get(i)));
			}

		}

		HashMap<String, ArrayList<String>> sssetsetArrayListHashMap = new HashMap<String, ArrayList<String>>();

		for (int colorsNum = 0; colorsNum < colors.size(); colorsNum++) {
			Iterator<String> it = hashMap2.get(colors.get(colorsNum)).iterator();
			ArrayList<String> sssetsetArrayList = new ArrayList<String>();
			while (it.hasNext()) {
				sssetsetArrayList.add(it.next());
			}
			sssetsetArrayListHashMap.put(colors.get(colorsNum), sssetsetArrayList);
		}

		pxsHashMap = new HashMap<String, double[]>();
		pysHashMap = new HashMap<String, double[]>();

		for (int colorsNum = 0; colorsNum < colors.size(); colorsNum++) {
			double pX[] = new double[xValueAllArrayList.size()];
			double pY[] = new double[xValueAllArrayList.size()];
			for (int i = 0; i < hashMap2.get(colors.get(colorsNum)).size(); i++) {
				if (hashMap2.get(colors.get(colorsNum)).size() > 1) {
					int totalNum = 0;
					double sum = 0;
					pX[i] = xValuesDoubleSetHashMap.get(colors.get(colorsNum)).get(i);
					for (int j = 0; j < 16; j++) {
						if (colors.get(colorsNum).equals(dataSourceListBlock1.get(j).get("item_image"))) {
							if (sssetsetArrayListHashMap.get(colors.get(colorsNum)).get(i)
									.equals(dataSourceListBlock1.get(j).get("item_text"))) {
								sum = sum + dataListCTArrayList.get(j).getYValForXIndex(j);
								totalNum++;
							}
						}
						if (colors.get(colorsNum).equals(dataSourceListBlock2.get(j).get("item_image"))) {
							if (sssetsetArrayListHashMap.get(colors.get(colorsNum)).get(i)
									.equals(dataSourceListBlock2.get(j).get("item_text"))) {
								sum = sum + dataListCTArrayList.get(j + 16).getYValForXIndex(j + 16);
								totalNum++;
							}
						}

					}
					pY[i] = sum / totalNum;
				}

			}
			pxsHashMap.put(colors.get(colorsNum), pX);
			pysHashMap.put(colors.get(colorsNum), pY);
		}

		for (int colorsNum = 0; colorsNum < colors.size(); colorsNum++) {
			Boolean no0 = false;
			for (int i = 0; i < pxsHashMap.get(colors.get(colorsNum)).length; i++) {
				if (pxsHashMap.get(colors.get(colorsNum))[i] != 0) {
					no0 = true;
					break;

				}
			}
			if (no0) {
				if (pxsHashMap.get(colors.get(colorsNum)).length > 1) {
					// ！！！！！！！！！！！！！！！！！！！！
					// ！！！！！！！！！！！！！！！！！！！！
					// ！！！！！！！！！！！！！！！！！！！！
					// 带入了xx 有问题！！！！！！！！！！！！！！！！！！！！！！！！！！
					myLeastSquareMethod.Create(pxsHashMap.get(colors.get(colorsNum)),
							pysHashMap.get(colors.get(colorsNum)), pxsHashMap.get(colors.get(colorsNum)).length);

					// 获取sample的基因盘的ct值

					ArrayList<String> smpleYValeueArrayList = new ArrayList<String>();
					for (int i = 0; i < 16; i++) {
						if ("sample".equals(dataSourceListBlock1.get(i).get("item_type"))) {
							if (dataSourceListBlock1.get(i).get("item_image").equals(colors.get(colorsNum))) {
								smpleYValeueArrayList.add(dataListCTArrayList.get(i).getYValForXIndex(i) + "");
							}

						}
						if ("sample".equals(dataSourceListBlock2.get(i).get("item_type"))) {

							if (dataSourceListBlock2.get(i).get("item_image").equals(colors.get(colorsNum))) {
								smpleYValeueArrayList
										.add(dataListCTArrayList.get(i + 16).getYValForXIndex(i + 16) + "");
							}

						}
					}
					Set<Double> linshiSet = new HashSet<Double>();
					ArrayList<Double> linshiList = new ArrayList<Double>();

					int[] myCoff = new int[4];
					double k = myLeastSquareMethod.GetSlope(myCoff);
					// myCoff[0]=0表示求解成功，myCoff[0]=2表示求解失败。
					if (myCoff[0] == 2) {
						// 失败
						white_line.setVisibility(View.VISIBLE);
						main_line.setVisibility(View.INVISIBLE);
					} else if (myCoff[0] == 0) {
						// 可以使用此页面
						white_line.setVisibility(View.INVISIBLE);
						main_line.setVisibility(View.VISIBLE);
						// 成功
						for (String ss : smpleYValeueArrayList) {
							double myXout;
							myXout = myLeastSquareMethod.CalculateXValue(Double.parseDouble(ss));
							linshiSet.add(myXout);
							linshiList.add(myXout);
						}
						// ArrayList<Double> linshisetArrayList = new
						// ArrayList<Double>();
						//
						// Iterator<String> itSet = sssetset.iterator();
						// // float保留两位小数
						// DecimalFormat fnum = new DecimalFormat("##0.00");
						// while (itSet.hasNext()) {
						// linshisetArrayList.add(Double.parseDouble(fnum.format(Double
						// .parseDouble(itSet.next()))));
						// }
						Iterator<Double> itSet = linshiSet.iterator();
						while (itSet.hasNext()) {
							String next =itSet.next()+"";
							if("NaN".equals(next)){
								
							}else {
								xValueAllArrayList.add(Double.parseDouble(next));
							}
							
						}
						 Collections.sort(xValueAllArrayList);
//						for (int i = 0; i < xValueAllArrayList.size() - 1; i++) {
//							for (int j = 0; j < xValueAllArrayList.size() - i - 1; j++) {// 比较两个整数
//								if (xValueAllArrayList.get(j) > xValueAllArrayList.get(j + 1)) {
//									/* 交换 */
//									Double temp = xValueAllArrayList.get(j);
//									xValueAllArrayList.set(j, xValueAllArrayList.get(j + 1));
//									xValueAllArrayList.set(j + 1, temp);
//								}
//							}
//						}

						// float保留两位小数
						DecimalFormat fnum = new DecimalFormat("##0.00");
						for (int i = 0; i < xValueAllArrayList.size(); i++) {
							xValueAllArrayList.set(i, Double.parseDouble(fnum.format(xValueAllArrayList.get(i))));
						}

						xValues = new ArrayList<String>();

						for (int i = 0; i < xValueAllArrayList.size(); i++) {
							Boolean boolean1 = true;
							for (int j = 0; j < xValues.size(); j++) {
								if (xValues.get(j).equals(xValueAllArrayList.get(i) + "")) {
									boolean1 = false;
								}
							}
							if (boolean1) {
								xValues.add(xValueAllArrayList.get(i) + "");
							}

						}

						// b
						double b = myLeastSquareMethod.GetIntercept(myCoff);
						// double max = linshiList.get(0);
						// double min = linshiList.get(0);
						//
						// for (int i = 0; i < xValues.size(); i++) {
						// if (min > Double.parseDouble(xValues.get(i))) {
						// min = Double.parseDouble(xValues.get(i));
						// }
						// if (max < Double.parseDouble(xValues.get(i))) {
						// max = Double.parseDouble(xValues.get(i));
						// }
						// }

						ArrayList<Entry> yValues = new ArrayList<Entry>();
						// 求y轴的值，
						// for (int i = 0; i < xValues.size(); i++) {
						// if (xValues.get(i).equals(min)) {
						// min = i;
						// } else if (xValues.get(i).equals(max)) {
						// max = i;
						// }
						// }
						// yValues.add(new Entry((float) (k
						// * Float.parseFloat(xValues.get(0)) + b), 0));
						// yValues.add(new Entry((float) (k
						// * Float.parseFloat(xValues.get(
						// xValues.size() - 1)) + b), xValues
						// .size() - 1));

						// // 求出最大最小的x轴坐标
						// ArrayList<Double> linshiDoubles = new
						// ArrayList<Double>();
						// for (int i = 0; i <
						// xValuesDoubleSetHashMap.get(colors.get(colorsNum))
						// .size(); i++) {
						// linshiDoubles.add(Double.parseDouble(fnum.format(xValuesDoubleSetHashMap.get(
						// colors.get(colorsNum)).get(i))));
						// }
						// Collections.sort(linshiDoubles);
						//
						// int first=0 ,end=0 ;
						// for(int i= 0; i<xValues.size();i++){
						// if(linshiDoubles.get(0).toString().equals(xValues.get(i))){
						// first=i;
						// }
						// if(linshiDoubles.get(linshiDoubles.size()-1).toString().equals(xValues.get(i))){
						// end=i;
						// }
						// }

						yValues.add(new Entry((float) (k * Float.parseFloat(xValues.get(0)) + b), 0));
						yValues.add(new Entry((float) (k * Float.parseFloat(xValues.get(xValues.size() - 1)) + b),
								xValues.size() - 1));

						redLineDataSet = new LineDataSet(yValues, "");
						redLineDataSet.setValueTextSize(0);
						redLineDataSet.setCircleSize(0);
						// this.getResources().getColor(R.color.textColor_black)
						// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
						redLineDataSet.setColor(getResources()
								.getColor(getcolor(activityLayoutTableBeans.get(colorsNum).getColor() + "")));
						dataSets.add(redLineDataSet);

						// 将数据加入dataSets

						// 构建一个LineData 将dataSets放入

						LineData lineData = new LineData(xValues, redLineDataSet);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						chart.removeAllViews();
						Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						mLegend.setForm(LegendForm.SQUARE);// 样式
						mLegend.setFormSize(0f);// 字体
						mLegend.setTextColor(Color.WHITE);// 颜色

						chart.animateX(0); // 立即执行的动画,x轴

						double myXout = 0;
						double myRR = 0;
						double mYintrer = 0;
						double myEff = 0;
						double mySlope = 0;

						mySlope = myLeastSquareMethod.GetSlope(myCoff);// 求直线的K值
						mYintrer = myLeastSquareMethod.GetIntercept(myCoff);// 求直线的y-intercept值
						myRR = myLeastSquareMethod.GetRR(myCoff);// 求直线的RR值
						DecimalFormat fnum3Wei = new DecimalFormat("##0.000");
						// Log（1+Eff）=- 1/mySlope ---------------
						standCurveBeans.get(colorsNum).setSlope(fnum3Wei.format(mySlope) + "");
						standCurveBeans.get(colorsNum).setyInter(fnum3Wei.format(mYintrer) + "");
						standCurveBeans.get(colorsNum).setR2(fnum3Wei.format(myRR) + "");
						if (mySlope != 0) {
							standCurveBeans.get(colorsNum)
									.setEffString(fnum3Wei.format((Math.pow(10, 1 / -mySlope) - 1) * 100) + "");
						}

						myAdapter.notifyDataSetChanged();

					}
				}
			} else {
				continue;
			}

		}

	}

	private void initDragGridView() {
		int index = 0;

		for (int i = 0; i < 16; i++) {
			HashMap<String, Object> hashMap = new HashMap<String, Object>();
			String item_image = contextString.substring(contextString.indexOf("item_image:", index) + 11,
					contextString.indexOf(",item_text:", index)).trim();
			String item_text = contextString.substring(contextString.indexOf("item_text:", index) + 10,
					contextString.indexOf(",item_selected:", index)).trim();
			Boolean item_selected = Boolean.getBoolean(contextString.substring(
					contextString.indexOf("item_selected:", index) + 14, contextString.indexOf(",item_null:", index)));

			boolean item_null = false;
			if ("null".equals(contextString.substring(contextString.indexOf("item_null:", index) + 10,
					contextString.indexOf(",item_aisle:", index)))) {
				item_null = true;
				hashMap.put("item_null", item_null);
			} else {
				item_null = false;
				hashMap.put("item_null", item_null);
			}
			// = contextString.substring(
			// contextString.indexOf("item_null:", index) + 10,
			// contextString.indexOf(",item_aisle:", index));
			int item_aisle = 0;
			if ("null".equals(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
					contextString.indexOf(",item_type:", index)).trim())) {

			} else {
				item_aisle = Integer.parseInt(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
						contextString.indexOf(",item_type:", index)).trim());
			}

			// String item_type = contextString.substring(
			// contextString.indexOf("item_type:", index) + 11,
			// contextString.indexOf("item_type:", index));

			int nextIndex = contextString.indexOf("item_image:", index) + 11;

			String item_type = "";
			if (i == 15) {
				item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
						contextString.indexOf(",,dataSourceListBlock2", index)).trim();

			} else {
				item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
						contextString.indexOf(",item_image:", nextIndex)).trim();
			}

			// LogUtil.e(item_image);
			// LogUtil.e(item_text);
			// LogUtil.e(item_selected);
			// // LogUtil.e(item_null+"");
			// // LogUtil.e(item_aisle+"");
			// LogUtil.e(item_type);

			hashMap.put("item_image", item_image);
			hashMap.put("item_text", item_text);
			hashMap.put("item_selected", item_selected);

			hashMap.put("item_aisle", item_aisle);
			hashMap.put("item_type", item_type);

			dataSourceListBlock1.add(hashMap);
			index = contextString.indexOf("item_type:", index) + 10;
		}

		for (int i = 0; i < 16; i++) {
			HashMap<String, Object> hashMap = new HashMap<String, Object>();
			String item_image = contextString.substring(contextString.indexOf("item_image:", index) + 11,
					contextString.indexOf(",item_text:", index)).trim();
			String item_text = contextString.substring(contextString.indexOf("item_text:", index) + 10,
					contextString.indexOf(",item_selected:", index)).trim();
			Boolean item_selected = Boolean.getBoolean(contextString.substring(
					contextString.indexOf("item_selected:", index) + 14, contextString.indexOf(",item_null:", index)));

			boolean item_null = false;
			if ("null".equals(contextString.substring(contextString.indexOf("item_null:", index) + 10,
					contextString.indexOf(",item_aisle:", index)))) {
				item_null = true;
				hashMap.put("item_null", item_null);
			} else {
				item_null = false;
				hashMap.put("item_null", item_null);
			}
			// = contextString.substring(
			// contextString.indexOf("item_null:", index) + 10,
			// contextString.indexOf(",item_aisle:", index));
			int item_aisle = 0;
			if ("null".equals(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
					contextString.indexOf(",item_type:", index)).trim())) {

			} else {
				item_aisle = Integer.parseInt(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
						contextString.indexOf(",item_type:", index)).trim());
			}

			// String item_type = contextString.substring(
			// contextString.indexOf("item_type:", index) + 11,
			// contextString.indexOf("item_type:", index));

			int nextIndex = contextString.indexOf("item_image:", index) + 11;

			String item_type = "";
			if (contextString.indexOf("item_image:", nextIndex) < 0) {

				// TODO 最后一位不出来颜色bug在这以后再改
				if ("Absolute Quantitation"
						.equals(SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))
						| "绝对定量".equals(SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))) {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",,cameraSet", nextIndex)).trim();
				} else if ("Standard Curve Relative Quantitation"
						.equals(SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))
						| "标准曲线相对定量".equals(SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))) {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",,endogenousControl", nextIndex)).trim();
				} else if ("⊿Ct Relative Quantitation"
						.equals(SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))
						| "比较ct值相对定量".equals(SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))) {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",,endogenousControl", nextIndex)).trim();
				}
				// ByAlert.alert(contextString.substring(
				// contextString.indexOf("item_type:", index) + 10,
				// contextString.length()-1));
			} else {
				if (i == 15) {

				} else {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",item_image:", nextIndex)).trim();
				}
			}

			// LogUtil.e(item_image);
			// LogUtil.e(item_text);
			// LogUtil.e(item_selected);
			// // LogUtil.e(item_null+"");
			// // LogUtil.e(item_aisle+"");
			// LogUtil.e(item_type);

			hashMap.put("item_image", item_image);
			hashMap.put("item_text", item_text);
			hashMap.put("item_selected", item_selected);

			hashMap.put("item_aisle", item_aisle);
			hashMap.put("item_type", item_type);

			dataSourceListBlock2.add(hashMap);
			index = contextString.indexOf("item_type:", index) + 10;
		}
		// LogUtil.e(dataSourceListBlock2);
		// dataSourceListBlock2.get(15);

		Gson gson = new Gson();
		String json = "";
		json = (String) SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this, "positionsArrayList", "");
		Type type = new TypeToken<HashSet<Integer>>() {
		}.getType();
		HashSet<Integer> positionsArrayList = new HashSet<Integer>();
		if (TextUtils.isEmpty(json)) {

		} else {
			positionsArrayList = gson.fromJson(json, type);
		}

		if (positionsArrayList != null) {
			for (int i : positionsArrayList) {
				if (i < 16) {
					HashMap<String, Object> hashMap = new HashMap<String, Object>();
					hashMap.put("item_image", "");
					hashMap.put("item_text", "");
					hashMap.put("item_selected", false);

					hashMap.put("item_aisle", 0);
					hashMap.put("item_type", "null");
					dataSourceListBlock1.set(i, hashMap);
				} else {
					HashMap<String, Object> hashMap = new HashMap<String, Object>();
					hashMap.put("item_image", "");
					hashMap.put("item_text", "");
					hashMap.put("item_selected", false);

					hashMap.put("item_aisle", 0);
					hashMap.put("item_type", "null");
					dataSourceListBlock2.set(i - 16, hashMap);
				}
			}
		}

		dataSourceListBlockToShow.addAll(dataSourceListBlock1);

		dragGridViewAdapter = new DragGridViewAdapter(dataSourceListBlockToShow);

		dragGridView.setAdapter(dragGridViewAdapter);
		dragGridView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int position, long id) {
				if ("block1".equals(blockStr)) {
					if ((Boolean) dataSourceListBlock1.get(position).get("item_selected")) {
						dataSourceListBlock1.get(position).put("item_selected", false);

						// 先判断此基因盘相同的target能不能有两个以上如果没有没直线
						for (int colorPosition = 0; colorPosition < colors.size(); colorPosition++) {
							// 先判断是红点还是 蓝点， 其他的不管
							if ("sample".equals(dataSourceListBlock1.get(position).get("item_type"))) {
								// 蓝点
								// 通过y的值 求x

								if (dataSourceListBlock1.get(position).get("item_image")
										.equals(colors.get(colorPosition))) {
									if (hashMap2.get(colors.get(colorPosition)).size() > 1) {
										// dataListCTArrayList.get(position)
										// .getYValForXIndex(position);// y轴数据

										// pxsHashMap.get(colors.get(colorPosition));
										// pysHashMap.get(colors.get(colorPosition));

										Boolean no0 = false;
										for (int i = 0; i < pxsHashMap.get(colors.get(colorPosition)).length; i++) {
											if (pxsHashMap.get(colors.get(colorPosition))[i] != 0) {
												no0 = true;
												break;

											}
										}
										if (no0) {
											// ！！！！！！！！！！！！！！！！！！！！
											// ！！！！！！！！！！！！！！！！！！！！
											// ！！！！！！！！！！！！！！！！！！！！
											// 带入了xx
											// 有问题！！！！！！！！！！！！！！！！！！！！！！！！！！
											myLeastSquareMethod.Create(pxsHashMap.get(colors.get(colorPosition)),
													pysHashMap.get(colors.get(colorPosition)),
													pxsHashMap.get(colors.get(colorPosition)).length);

											int[] myCoff = new int[4];
											double k = myLeastSquareMethod.GetSlope(myCoff);
											if (myCoff[0] == 2) {
												// 失败
												ByAlert.alert(getString(R.string.standardcurve_dataerrer));
											} else if (myCoff[0] == 0) {
												double myXout;
												// 求出y轴的值带入
												double ss = 0;
												if (dataSourceListBlock1.get(position).get("item_image")
														.equals(colors.get(colorPosition))) {
													ss = dataListCTArrayList.get(position).getYValForXIndex(position);
												}

												myXout = myLeastSquareMethod.CalculateXValue(ss);

												// 加点
												ArrayList<Entry> yValues = new ArrayList<Entry>();
												// 求y轴的值，
												// for (int i = 0; i <
												// xValues.size();
												// i++) {
												// if
												// (xValues.get(i).equals(min))
												// {
												// min = i;
												// } else if
												// (xValues.get(i).equals(max))
												// {
												// max = i;
												// }
												// }

												Collections.sort(xValueAllArrayList);
												// float保留两位小数
												DecimalFormat fnum = new DecimalFormat("##0.00");
												for (int i = 0; i < xValueAllArrayList.size(); i++) {
													xValueAllArrayList.set(i,
															Double.parseDouble(fnum.format(xValueAllArrayList.get(i))));
												}

												int x = 0;
												for (int i = 0; i < xValueAllArrayList.size(); i++) {
													if (Double.parseDouble(fnum.format(myXout)) == xValueAllArrayList
															.get(i)) {
														x = i;
														break;
													}
												}
												yValues.add(new Entry((float) ss, x));

												LineDataSet lineDataSet = new LineDataSet(yValues, "");
												lineDataSet.setValueTextSize(0);
												lineDataSet.setCircleSize(5);
												lineDataSet.setCircleColor(Color.BLUE);
												lineDataSet.setCircleColorHole(Color.BLUE);
												// this.getResources().getColor(R.color.textColor_black)
												// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
												lineDataSet.setColor(Color.RED);

												for (int i = 0; i < dataSets.size(); i++) {
													if (dataSets.get(i).toString().equals(lineDataSet.toString())) {
														dataSets.remove(i);
														break;
													}
												}
												// dataSets.add(lineDataSet);

												// 将数据加入dataSets

												// 构建一个LineData 将dataSets放入
												LineData lineData = new LineData(xValues, dataSets);

												// mLineChart2.setBackgroundColor(Color.BLUE);
												chart.setGridBackgroundColor(Color.WHITE);
												// 将数据插入
												chart.setData(lineData);
												chart.removeAllViews();
												Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
												mLegend.setXEntrySpace(7f);
												mLegend.setYEntrySpace(5f);
												mLegend.setForm(LegendForm.SQUARE);// 样式
												mLegend.setFormSize(0f);// 字体
												mLegend.setTextColor(Color.WHITE);// 颜色

												chart.animateX(0); // 立即执行的动画,x轴

											}

										}

									} else {
										ByAlert.alert(getString(R.string.standardcurve_dataerrer));
									}

								}

							} else if ("standard".equals(dataSourceListBlock1.get(position).get("item_type"))) {
								// 红点
								if (dataSourceListBlock1.get(position).get("item_image")
										.equals(colors.get(colorPosition))) {
									if (hashMap2.get(colors.get(colorPosition)).size() > 1) {
										// 加点
										String item_text = dataSourceListBlock1.get(position).get("item_text") + "";
										item_text = item_text.substring(3, item_text.length());

										double xzhou = MathLog.log(
												(float) (Float.parseFloat(
														item_text.substring(0, item_text.indexOf("E")))
												* (Math.pow(10, Integer.parseInt(item_text
														.substring(item_text.indexOf("E") + 1, item_text.length()))))),
												10);
										// 从x轴\
										DecimalFormat fnum = new DecimalFormat("##0.00");
										xValueAllArrayList.indexOf(xzhou + "");// 第几个x轴数据
										dataListCTArrayList.get(position).getYValForXIndex(position);// y轴数据
										ArrayList<Entry> yValues = new ArrayList<Entry>();
										// 求y轴的值，
										// for (int i = 0; i < xValues.size();
										// i++) {
										// if (xValues.get(i).equals(min)) {
										// min = i;
										// } else if
										// (xValues.get(i).equals(max)) {
										// max = i;
										// }
										// }
										yValues.add(
												new Entry(
														(float) dataListCTArrayList.get(position).getYValForXIndex(
																position),
												xValueAllArrayList.indexOf(Double.parseDouble(fnum.format(xzhou)))));

										LineDataSet lineDataSet = new LineDataSet(yValues, "");
										lineDataSet.setValueTextSize(0);
										lineDataSet.setCircleSize(5);
										lineDataSet.setCircleColor(Color.RED);
										lineDataSet.setCircleColorHole(Color.RED);
										// this.getResources().getColor(R.color.textColor_black)
										// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
										lineDataSet.setColor(Color.RED);
										for (int i = 0; i < dataSets.size(); i++) {
											if (dataSets.get(i).toString().equals(lineDataSet.toString())) {
												dataSets.remove(i);
												break;
											}
										}

										// 将数据加入dataSets

										// 构建一个LineData 将dataSets放入
										LineData lineData = new LineData(xValues, dataSets);

										// mLineChart2.setBackgroundColor(Color.BLUE);
										chart.setGridBackgroundColor(Color.WHITE);
										// 将数据插入
										chart.setData(lineData);
										chart.removeAllViews();
										Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
										mLegend.setXEntrySpace(7f);
										mLegend.setYEntrySpace(5f);
										mLegend.setForm(LegendForm.SQUARE);// 样式
										mLegend.setFormSize(0f);// 字体
										mLegend.setTextColor(Color.WHITE);// 颜色

										chart.animateX(0); // 立即执行的动画,x轴
									} else {
										// 不加点
									}
								}
							} else {
								// 没效果
							}

						}

					} else {
						dataSourceListBlock1.get(position).put("item_selected", true);
						// 先判断此基因盘相同的target能不能有两个以上如果没有没直线
						for (int colorPosition = 0; colorPosition < colors.size(); colorPosition++) {
							// 先判断是红点还是 蓝点， 其他的不管
							if ("sample".equals(dataSourceListBlock1.get(position).get("item_type"))) {
								// 蓝点
								// 通过y的值 求x

								if (dataSourceListBlock1.get(position).get("item_image")
										.equals(colors.get(colorPosition))) {
									if (hashMap2.get(colors.get(colorPosition)).size() > 1) {
										// dataListCTArrayList.get(position)
										// .getYValForXIndex(position);// y轴数据

										// pxsHashMap.get(colors.get(colorPosition));
										// pysHashMap.get(colors.get(colorPosition));

										Boolean no0 = false;
										for (int i = 0; i < pxsHashMap.get(colors.get(colorPosition)).length; i++) {
											if (pxsHashMap.get(colors.get(colorPosition))[i] != 0) {
												no0 = true;
												break;

											}
										}
										if (no0) {
											// ！！！！！！！！！！！！！！！！！！！！
											// ！！！！！！！！！！！！！！！！！！！！
											// ！！！！！！！！！！！！！！！！！！！！
											// 带入了xx
											// 有问题！！！！！！！！！！！！！！！！！！！！！！！！！！
											myLeastSquareMethod.Create(pxsHashMap.get(colors.get(colorPosition)),
													pysHashMap.get(colors.get(colorPosition)),
													pxsHashMap.get(colors.get(colorPosition)).length);

											int[] myCoff = new int[4];
											double k = myLeastSquareMethod.GetSlope(myCoff);
											if (myCoff[0] == 2) {
												// 失败
												ByAlert.alert(getString(R.string.standardcurve_dataerrer));
											} else if (myCoff[0] == 0) {
												double myXout;
												// 求出y轴的值带入
												double ss = 0;
												if (dataSourceListBlock1.get(position).get("item_image")
														.equals(colors.get(colorPosition))) {
													ss = dataListCTArrayList.get(position).getYValForXIndex(position);
												}

												myXout = myLeastSquareMethod.CalculateXValue(ss);

												// 加点
												ArrayList<Entry> yValues = new ArrayList<Entry>();
												// 求y轴的值，
												// for (int i = 0; i <
												// xValues.size();
												// i++) {
												// if
												// (xValues.get(i).equals(min))
												// {
												// min = i;
												// } else if
												// (xValues.get(i).equals(max))
												// {
												// max = i;
												// }
												// }

												Collections.sort(xValueAllArrayList);
												// float保留两位小数
												DecimalFormat fnum = new DecimalFormat("##0.00");
												for (int i = 0; i < xValueAllArrayList.size(); i++) {

													xValueAllArrayList.set(i,
															Double.parseDouble(fnum.format(xValueAllArrayList.get(i))));

												}
												int x = 0;
												for (int i = 0; i < xValueAllArrayList.size(); i++) {
													if (Double.parseDouble(fnum.format(myXout)) == xValueAllArrayList
															.get(i)) {
														x = i;
														break;
													}
												}
												yValues.add(new Entry((float) ss, x));

												LineDataSet lineDataSet = new LineDataSet(yValues, "");
												lineDataSet.setValueTextSize(0);
												lineDataSet.setCircleSize(5);
												lineDataSet.setCircleColor(Color.BLUE);
												lineDataSet.setCircleColorHole(Color.BLUE);
												// this.getResources().getColor(R.color.textColor_black)
												// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
												lineDataSet.setColor(Color.RED);
												dataSets.add(lineDataSet);

												// 将数据加入dataSets

												// 构建一个LineData 将dataSets放入
												LineData lineData = new LineData(xValues, dataSets);

												// mLineChart2.setBackgroundColor(Color.BLUE);
												chart.setGridBackgroundColor(Color.WHITE);
												// 将数据插入
												chart.setData(lineData);
												chart.removeAllViews();
												Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
												mLegend.setXEntrySpace(7f);
												mLegend.setYEntrySpace(5f);
												mLegend.setForm(LegendForm.SQUARE);// 样式
												mLegend.setFormSize(0f);// 字体
												mLegend.setTextColor(Color.WHITE);// 颜色

												chart.animateX(0); // 立即执行的动画,x轴

											}

										}

									} else {
										ByAlert.alert(getString(R.string.standardcurve_dataerrer));
									}

								}

							} else if ("standard".equals(dataSourceListBlock1.get(position).get("item_type"))) {
								// 红点
								if (dataSourceListBlock1.get(position).get("item_image")
										.equals(colors.get(colorPosition))) {
									if (hashMap2.get(colors.get(colorPosition)).size() > 1) {
										// 加点
										String item_text = dataSourceListBlock1.get(position).get("item_text") + "";
										item_text = item_text.substring(3, item_text.length());

										double xzhou = MathLog.log(
												(float) (Float.parseFloat(
														item_text.substring(0, item_text.indexOf("E")))
												* (Math.pow(10, Integer.parseInt(item_text
														.substring(item_text.indexOf("E") + 1, item_text.length()))))),
												10);
										// 从x轴\
										DecimalFormat fnum = new DecimalFormat("##0.00");

										xValueAllArrayList.indexOf(xzhou);// 第几个x轴数据

										dataListCTArrayList.get(position).getYValForXIndex(position);// y轴数据
										ArrayList<Entry> yValues = new ArrayList<Entry>();
										// 求y轴的值，
										// for (int i = 0; i < xValues.size();
										// i++) {
										// if (xValues.get(i).equals(min)) {
										// min = i;
										// } else if
										// (xValues.get(i).equals(max)) {
										// max = i;
										// }
										// }

										removeDuplicateWithOrder(xValueAllArrayList);
										yValues.add(
												new Entry(
														(float) dataListCTArrayList.get(position).getYValForXIndex(
																position),
												xValueAllArrayList.indexOf(Double.parseDouble(fnum.format(xzhou)))));

										LineDataSet lineDataSet = new LineDataSet(yValues, "");
										lineDataSet.setValueTextSize(0);
										lineDataSet.setCircleSize(5);
										lineDataSet.setCircleColor(Color.RED);
										lineDataSet.setCircleColorHole(Color.RED);
										// this.getResources().getColor(R.color.textColor_black)
										// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
										lineDataSet.setColor(Color.RED);
										dataSets.add(lineDataSet);

										// 将数据加入dataSets

										// 构建一个LineData 将dataSets放入
										LineData lineData = new LineData(xValues, dataSets);

										// mLineChart2.setBackgroundColor(Color.BLUE);
										chart.setGridBackgroundColor(Color.WHITE);
										// 将数据插入
										chart.setData(lineData);
										chart.removeAllViews();
										Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
										mLegend.setXEntrySpace(7f);
										mLegend.setYEntrySpace(5f);
										mLegend.setForm(LegendForm.SQUARE);// 样式
										mLegend.setFormSize(0f);// 字体
										mLegend.setTextColor(Color.WHITE);// 颜色

										chart.animateX(0); // 立即执行的动画,x轴
									} else {
										// 不加点
									}
								}
							} else {
								// 没效果
							}

						}
					}
				}
				if ("block2".equals(blockStr)) {
					if ((Boolean) dataSourceListBlock2.get(position).get("item_selected")) {
						dataSourceListBlock2.get(position).put("item_selected", false);

						// 先判断此基因盘相同的target能不能有两个以上如果没有没直线
						for (int colorPosition = 0; colorPosition < colors.size(); colorPosition++) {
							// 先判断是红点还是 蓝点， 其他的不管
							if ("sample".equals(dataSourceListBlock2.get(position).get("item_type"))) {
								// 蓝点
								// 通过y的值 求x

								if (dataSourceListBlock2.get(position).get("item_image")
										.equals(colors.get(colorPosition))) {
									if (hashMap2.get(colors.get(colorPosition)).size() > 1) {
										// dataListCTArrayList.get(position)
										// .getYValForXIndex(position);// y轴数据

										// pxsHashMap.get(colors.get(colorPosition));
										// pysHashMap.get(colors.get(colorPosition));

										Boolean no0 = false;
										for (int i = 0; i < pxsHashMap.get(colors.get(colorPosition)).length; i++) {
											if (pxsHashMap.get(colors.get(colorPosition))[i] != 0) {
												no0 = true;
												break;

											}
										}
										if (no0) {
											// ！！！！！！！！！！！！！！！！！！！！
											// ！！！！！！！！！！！！！！！！！！！！
											// ！！！！！！！！！！！！！！！！！！！！
											// 带入了xx
											// 有问题！！！！！！！！！！！！！！！！！！！！！！！！！！
											myLeastSquareMethod.Create(pxsHashMap.get(colors.get(colorPosition)),
													pysHashMap.get(colors.get(colorPosition)),
													pxsHashMap.get(colors.get(colorPosition)).length);

											int[] myCoff = new int[4];
											double k = myLeastSquareMethod.GetSlope(myCoff);
											if (myCoff[0] == 2) {
												// 失败
												ByAlert.alert(getString(R.string.standardcurve_dataerrer));
											} else if (myCoff[0] == 0) {
												double myXout;
												// 求出y轴的值带入
												double ss = 0;
												if (dataSourceListBlock2.get(position).get("item_image")
														.equals(colors.get(colorPosition))) {
													ss = dataListCTArrayList.get(position + 16)
															.getYValForXIndex(position + 16);
												}

												myXout = myLeastSquareMethod.CalculateXValue(ss);

												// 加点
												ArrayList<Entry> yValues = new ArrayList<Entry>();
												// 求y轴的值，
												// for (int i = 0; i <
												// xValues.size();
												// i++) {
												// if
												// (xValues.get(i).equals(min))
												// {
												// min = i;
												// } else if
												// (xValues.get(i).equals(max))
												// {
												// max = i;
												// }
												// }

												Collections.sort(xValueAllArrayList);
												// float保留两位小数
												DecimalFormat fnum = new DecimalFormat("##0.00");
												for (int i = 0; i < xValueAllArrayList.size(); i++) {
													xValueAllArrayList.set(i,
															Double.parseDouble(fnum.format(xValueAllArrayList.get(i))));
												}

												int x = 0;
												for (int i = 0; i < xValueAllArrayList.size(); i++) {
													if (Double.parseDouble(fnum.format(myXout)) == xValueAllArrayList
															.get(i)) {
														x = i;
														break;
													}
												}
												yValues.add(new Entry((float) ss, x));

												LineDataSet lineDataSet = new LineDataSet(yValues, "");
												lineDataSet.setValueTextSize(0);
												lineDataSet.setCircleSize(5);
												lineDataSet.setCircleColor(Color.BLUE);
												lineDataSet.setCircleColorHole(Color.BLUE);
												// this.getResources().getColor(R.color.textColor_black)
												// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
												lineDataSet.setColor(Color.RED);

												for (int i = 0; i < dataSets.size(); i++) {
													if (dataSets.get(i).toString().equals(lineDataSet.toString())) {
														dataSets.remove(i);
														break;
													}
												}
												// dataSets.add(lineDataSet);

												// 将数据加入dataSets

												// 构建一个LineData 将dataSets放入
												LineData lineData = new LineData(xValues, dataSets);

												// mLineChart2.setBackgroundColor(Color.BLUE);
												chart.setGridBackgroundColor(Color.WHITE);
												// 将数据插入
												chart.setData(lineData);
												chart.removeAllViews();
												Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
												mLegend.setXEntrySpace(7f);
												mLegend.setYEntrySpace(5f);
												mLegend.setForm(LegendForm.SQUARE);// 样式
												mLegend.setFormSize(0f);// 字体
												mLegend.setTextColor(Color.WHITE);// 颜色

												chart.animateX(0); // 立即执行的动画,x轴

											}

										}

									} else {
										ByAlert.alert(getString(R.string.standardcurve_dataerrer));
									}

								}

							} else if ("standard".equals(dataSourceListBlock2.get(position).get("item_type"))) {
								// 红点
								if (dataSourceListBlock2.get(position).get("item_image")
										.equals(colors.get(colorPosition))) {
									if (hashMap2.get(colors.get(colorPosition)).size() > 1) {
										// 加点
										String item_text = dataSourceListBlock2.get(position).get("item_text") + "";
										item_text = item_text.substring(3, item_text.length());

										double xzhou = MathLog.log(
												(float) (Float.parseFloat(
														item_text.substring(0, item_text.indexOf("E")))
												* (Math.pow(10, Integer.parseInt(item_text
														.substring(item_text.indexOf("E") + 1, item_text.length()))))),
												10);
										// 从x轴\
										DecimalFormat fnum = new DecimalFormat("##0.00");
										// xValueAllArrayList.indexOf(xzhou +
										// "");// 第几个x轴数据
										// dataListCTArrayList.get(position)
										// .getYValForXIndex(position);// y轴数据
										ArrayList<Entry> yValues = new ArrayList<Entry>();
										// 求y轴的值，
										// for (int i = 0; i < xValues.size();
										// i++) {
										// if (xValues.get(i).equals(min)) {
										// min = i;
										// } else if
										// (xValues.get(i).equals(max)) {
										// max = i;
										// }
										// }
										yValues.add(new Entry(
												(float) dataListCTArrayList.get(position + 16)
														.getYValForXIndex(position + 16),
												xValueAllArrayList.indexOf(Double.parseDouble(fnum.format(xzhou)))));

										LineDataSet lineDataSet = new LineDataSet(yValues, "");
										lineDataSet.setValueTextSize(0);
										lineDataSet.setCircleSize(5);
										lineDataSet.setCircleColor(Color.RED);
										lineDataSet.setCircleColorHole(Color.RED);
										// this.getResources().getColor(R.color.textColor_black)
										// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
										lineDataSet.setColor(Color.RED);
										// dataSets.add(lineDataSet);
										for (int i = 0; i < dataSets.size(); i++) {
											if (dataSets.get(i).toString().equals(lineDataSet.toString())) {
												dataSets.remove(i);
												break;
											}
										}

										// 将数据加入dataSets

										// 构建一个LineData 将dataSets放入
										LineData lineData = new LineData(xValues, dataSets);

										// mLineChart2.setBackgroundColor(Color.BLUE);
										chart.setGridBackgroundColor(Color.WHITE);
										// 将数据插入
										chart.setData(lineData);
										chart.removeAllViews();
										Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
										mLegend.setXEntrySpace(7f);
										mLegend.setYEntrySpace(5f);
										mLegend.setForm(LegendForm.SQUARE);// 样式
										mLegend.setFormSize(0f);// 字体
										mLegend.setTextColor(Color.WHITE);// 颜色

										chart.animateX(0); // 立即执行的动画,x轴
									} else {
										// 不加点
									}
								}
							} else {
								// 没效果
							}

						}

					} else {
						dataSourceListBlock2.get(position).put("item_selected", true);
						// 先判断此基因盘相同的target能不能有两个以上如果没有没直线
						for (int colorPosition = 0; colorPosition < colors.size(); colorPosition++) {
							// 先判断是红点还是 蓝点， 其他的不管
							if ("sample".equals(dataSourceListBlock2.get(position).get("item_type"))) {
								// 蓝点
								// 通过y的值 求x

								if (dataSourceListBlock2.get(position).get("item_image")
										.equals(colors.get(colorPosition))) {
									if (hashMap2.get(colors.get(colorPosition)).size() > 1) {
										// dataListCTArrayList.get(position)
										// .getYValForXIndex(position);// y轴数据

										// pxsHashMap.get(colors.get(colorPosition));
										// pysHashMap.get(colors.get(colorPosition));

										Boolean no0 = false;
										for (int i = 0; i < pxsHashMap.get(colors.get(colorPosition)).length; i++) {
											if (pxsHashMap.get(colors.get(colorPosition))[i] != 0) {
												no0 = true;
												break;

											}
										}
										if (no0) {
											// ！！！！！！！！！！！！！！！！！！！！
											// ！！！！！！！！！！！！！！！！！！！！
											// ！！！！！！！！！！！！！！！！！！！！
											// 带入了xx
											// 有问题！！！！！！！！！！！！！！！！！！！！！！！！！！
											myLeastSquareMethod.Create(pxsHashMap.get(colors.get(colorPosition)),
													pysHashMap.get(colors.get(colorPosition)),
													pxsHashMap.get(colors.get(colorPosition)).length);

											int[] myCoff = new int[4];
											double k = myLeastSquareMethod.GetSlope(myCoff);
											if (myCoff[0] == 2) {
												// 失败
												ByAlert.alert(getString(R.string.standardcurve_dataerrer));
											} else if (myCoff[0] == 0) {
												double myXout;
												// 求出y轴的值带入
												double ss = 0;
												if (dataSourceListBlock2.get(position).get("item_image")
														.equals(colors.get(colorPosition))) {
													ss = dataListCTArrayList.get(position + 16)
															.getYValForXIndex(position + 16);
												}

												myXout = myLeastSquareMethod.CalculateXValue(ss);

												// 加点
												ArrayList<Entry> yValues = new ArrayList<Entry>();
												// 求y轴的值，
												// for (int i = 0; i <
												// xValues.size();
												// i++) {
												// if
												// (xValues.get(i).equals(min))
												// {
												// min = i;
												// } else if
												// (xValues.get(i).equals(max))
												// {
												// max = i;
												// }
												// }

												Collections.sort(xValueAllArrayList);
												// float保留两位小数
												DecimalFormat fnum = new DecimalFormat("##0.00");
												for (int i = 0; i < xValueAllArrayList.size(); i++) {
													xValueAllArrayList.set(i,
															Double.parseDouble(fnum.format(xValueAllArrayList.get(i))));
												}

												int x = 0;
												for (int i = 0; i < xValueAllArrayList.size(); i++) {
													if (Double.parseDouble(fnum.format(myXout)) == xValueAllArrayList
															.get(i)) {
														x = i;
														break;
													}
												}
												yValues.add(new Entry((float) ss, x));

												LineDataSet lineDataSet = new LineDataSet(yValues, "");
												lineDataSet.setValueTextSize(0);
												lineDataSet.setCircleSize(5);
												lineDataSet.setCircleColor(Color.BLUE);
												lineDataSet.setCircleColorHole(Color.BLUE);
												// this.getResources().getColor(R.color.textColor_black)
												// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
												lineDataSet.setColor(Color.RED);
												dataSets.add(lineDataSet);

												// 将数据加入dataSets

												// 构建一个LineData 将dataSets放入
												LineData lineData = new LineData(xValues, dataSets);

												// mLineChart2.setBackgroundColor(Color.BLUE);
												chart.setGridBackgroundColor(Color.WHITE);
												// 将数据插入
												chart.setData(lineData);
												chart.removeAllViews();
												Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
												mLegend.setXEntrySpace(7f);
												mLegend.setYEntrySpace(5f);
												mLegend.setForm(LegendForm.SQUARE);// 样式
												mLegend.setFormSize(0f);// 字体
												mLegend.setTextColor(Color.WHITE);// 颜色

												chart.animateX(0); // 立即执行的动画,x轴

											}

										}

									} else {
										ByAlert.alert(getString(R.string.standardcurve_dataerrer));
									}

								}

							} else if ("standard".equals(dataSourceListBlock2.get(position).get("item_type"))) {
								// 红点
								if (dataSourceListBlock2.get(position).get("item_image")
										.equals(colors.get(colorPosition))) {
									if (hashMap2.get(colors.get(colorPosition)).size() > 1) {
										// 加点
										String item_text = dataSourceListBlock2.get(position).get("item_text") + "";
										item_text = item_text.substring(3, item_text.length());

										double xzhou = MathLog.log(
												(float) (Float.parseFloat(
														item_text.substring(0, item_text.indexOf("E")))
												* (Math.pow(10, Integer.parseInt(item_text
														.substring(item_text.indexOf("E") + 1, item_text.length()))))),
												10);

										for (int i = 0; i < xValueAllArrayList.size() - 1; i++) {
											for (int j = i + 1; j < xValueAllArrayList.size(); j++) {
												if (xValueAllArrayList.get(i) == (xValueAllArrayList.get(j))) {
													xValueAllArrayList.remove(j);
													j--;
												}
											}
										}
										removeDuplicateWithOrder(xValueAllArrayList);
										// 从x轴\
										DecimalFormat fnum = new DecimalFormat("##0.00");
										// xValueAllArrayList.indexOf(xzhou +
										// "");// 第几个x轴数据
										// dataListCTArrayList.get(position)
										// .getYValForXIndex(position);// y轴数据
										ArrayList<Entry> yValues = new ArrayList<Entry>();
										// 求y轴的值，
										// for (int i = 0; i < xValues.size();
										// i++) {
										// if (xValues.get(i).equals(min)) {
										// min = i;
										// } else if
										// (xValues.get(i).equals(max)) {
										// max = i;
										// }
										// }
										yValues.add(new Entry(
												(float) dataListCTArrayList.get(position + 16)
														.getYValForXIndex(position + 16),
												xValueAllArrayList.indexOf(Double.parseDouble(fnum.format(xzhou)))));

										LineDataSet lineDataSet = new LineDataSet(yValues, "");
										lineDataSet.setValueTextSize(0);
										lineDataSet.setCircleSize(5);
										lineDataSet.setCircleColor(Color.RED);
										lineDataSet.setCircleColorHole(Color.RED);
										// this.getResources().getColor(R.color.textColor_black)
										// lineDataSet.setColor(getResources().getDrawable(getcolor(activityLayoutTableBeans.get(colorsNum).getColor()+"")));
										lineDataSet.setColor(Color.RED);
										dataSets.add(lineDataSet);

										// 将数据加入dataSets

										// 构建一个LineData 将dataSets放入
										LineData lineData = new LineData(xValues, dataSets);

										// mLineChart2.setBackgroundColor(Color.BLUE);
										chart.setGridBackgroundColor(Color.WHITE);
										// 将数据插入
										chart.setData(lineData);
										chart.removeAllViews();
										Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
										mLegend.setXEntrySpace(7f);
										mLegend.setYEntrySpace(5f);
										mLegend.setForm(LegendForm.SQUARE);// 样式
										mLegend.setFormSize(0f);// 字体
										mLegend.setTextColor(Color.WHITE);// 颜色

										chart.animateX(0); // 立即执行的动画,x轴
									} else {
										// 不加点
									}
								}
							} else {
								// 没效果
							}

						}
					}
				}
				dragGridViewAdapter.notifyDataSetChanged();

			}
		});

		block1Btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				blockUpTv.setText("A");
				blockDownTv.setText("B");

				block1Btn.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
				block2Btn.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));

				dataSourceListBlockToShow.clear();
				dataSourceListBlockToShow.addAll(dataSourceListBlock1);
				dragGridViewAdapter.notifyDataSetChanged();

				blockStr = "block1";
			}
		});
		block2Btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				blockUpTv.setText("C");
				blockDownTv.setText("D");

				block1Btn.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));
				block2Btn.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
				dataSourceListBlockToShow.clear();
				dataSourceListBlockToShow.addAll(dataSourceListBlock2);
				dragGridViewAdapter.notifyDataSetChanged();

				blockStr = "block2";
			}
		});

	}

	private void initSpinner() {
		// layoutOne的数据解析
		activityLayoutTableBeans = new ArrayList<LayoutTableBean>();

		// LogUtil.e(contextString.indexOf(",Aisle") + 7);
		// LogUtil.e(contextString.indexOf(",Color"));

		int index = 0;
		while (!(contextString.indexOf("Aisle", index) <= 0)) {

			// Aisle:
			String aisle;
			aisle = contextString.substring(contextString.indexOf(",Aisle", index) + 7,

					contextString.indexOf(",Color", index));
					// LogUtil.e(aisle);

			// Color
			String color;
			color = contextString.substring(contextString.indexOf(",Color", index) + 7,

					contextString.indexOf(",Target", index));
					// LogUtil.e(color);

			// Target
			String target;
			target = contextString.substring(contextString.indexOf(",Target", index) + 8,

					contextString.indexOf(",Dyes", index));

			// LogUtil.e(target);

			int nextIndex = contextString.indexOf(",Aisle", index) + 7;

			// Dyes
			String dyes;
			if (contextString.indexOf(",Aisle", nextIndex) < 0) {

				dyes = contextString.substring(contextString.indexOf(",Dyes", index) + 6,
						contextString.indexOf(",,dataSourceListBlock1", index));

				// LogUtil.e(dyes);
			} else {

				dyes = contextString.substring(contextString.indexOf(",Dyes", index) + 6,

						contextString.indexOf(",Aisle", nextIndex));
				// LogUtil.e(dyes);
			}

			index = contextString.indexOf(",Dyes", index) + 5;

			activityLayoutTableBeans.add(new LayoutTableBean(false, Integer.parseInt(aisle.trim()),
					Integer.parseInt(color.trim()), target, dyes));

		}

		// 第一个下拉菜单的数据
		data_list1 = new ArrayList<String>();
		for (LayoutTableBean bean : activityLayoutTableBeans) {
			data_list1.add(bean.getTarget());
		}
		data_list1.add("All");
	}

	@Override
	protected void initData() {

	}

	@Override
	public void initAppHead() {

		setActionBar();
		setSystemTime();

	}

	@Override
	public void initBottomView() {
		// setBottomView();

	}

	@Override
	public void initSpinnerView() {

		// // 适配器
		// arr_adapter1 = new ArrayAdapter<String>(this,
		// android.R.layout.simple_spinner_item, data_list1);
		// // 设置样式
		// arr_adapter1
		// .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		// // 传入adapter
		// spinner1.setAdapter(arr_adapter1);
		// spinner1.setSelection(0, true);

		// spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {
		//
		// @Override
		// public void onItemSelected(AdapterView<?> parent, View view,
		// int position, long id) {
		// spinner1Position = position;
		//
		// }
		//
		// @Override
		// public void onNothingSelected(AdapterView<?> parent) {
		//
		// }
		// });
	}

	@Override
	public void initLineChart() {

		XAxis xAxis = chart.getXAxis();

		// 设置X轴的文字在底部
		xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);

		// 设置描述文字
		chart.setDescription("");

		xValues = new ArrayList<String>();
		// for (int i = -2; i < 3; i++) {
		// xValues.add(i + "");
		// }

		Log.e("wing", xValues.size() + "");

		// 模拟一组y轴数据(存放y轴数据的是一个Entry的ArrayList) 他是构建LineDataSet的参数之一

		ArrayList<Entry> yValue = new ArrayList<Entry>();

		// yValue.add(new Entry((float) 20.06212616, 4));
		// yValue.add(new Entry((float) 23.53442383, 3));
		// yValue.add(new Entry((float) 26.88744926, 2));
		// yValue.add(new Entry((float) 30.2791996, 1));
		// yValue.add(new Entry((float) 33.98432541, 0));

		dataSet1 = new LineDataSet(yValue, "");
		dataSet1.setColor(Color.BLACK);
		dataSet1.setCircleSize(4);
		dataSet1.setDrawCircleHole(false);

		dataSet1.setCircleColor(Color.RED);
		dataSet1.setValueTextSize(0);
		dataSet1.setLineWidth(2);
		// 模拟第二组组y轴数据(存放y轴数据的是一个Entry的ArrayList) 他是构建LineDataSet的参数之一

		// ArrayList<Entry> yValue1 = new ArrayList<Entry>();
		//
		// yValue1.add(new Entry(100, 0));
		// yValue1.add(new Entry(100, 1));
		// yValue1.add(new Entry(100, 2));
		// yValue1.add(new Entry(100, 3));
		// yValue1.add(new Entry(100, 4));
		// yValue1.add(new Entry(100, 5));
		// yValue1.add(new Entry(100, 6));
		// yValue1.add(new Entry(100, 7));
		// yValue1.add(new Entry(100, 8));
		// yValue1.add(new Entry(100, 9));
		// yValue1.add(new Entry(100, 10));
		// yValue1.add(new Entry(100, 11));
		// yValue1.add(new Entry(100, 12));
		// yValue1.add(new Entry(100, 13));
		// yValue1.add(new Entry(100, 14));
		// yValue1.add(new Entry(100, 15));
		// yValue1.add(new Entry(100, 16));
		// yValue1.add(new Entry(100, 17));
		// yValue1.add(new Entry(100, 18));
		// yValue1.add(new Entry(100, 19));
		// yValue1.add(new Entry(100, 20));
		// yValue1.add(new Entry(100, 21));
		// yValue1.add(new Entry(100, 22));
		// yValue1.add(new Entry(100, 23));
		// yValue1.add(new Entry(100, 24));
		// yValue1.add(new Entry(100, 25));
		// yValue1.add(new Entry(100, 26));
		// yValue1.add(new Entry(100, 27));
		// yValue1.add(new Entry(100, 28));
		// yValue1.add(new Entry(100, 29));
		// yValue1.add(new Entry(100, 30));
		// yValue1.add(new Entry(100, 31));
		// yValue1.add(new Entry(100, 32));
		// yValue1.add(new Entry(100, 33));
		// yValue1.add(new Entry(100, 34));
		// yValue1.add(new Entry(100, 35));
		// yValue1.add(new Entry(100, 36));
		// yValue1.add(new Entry(100, 37));
		// yValue1.add(new Entry(100, 38));
		// yValue1.add(new Entry(100, 39));
		//
		// Log.e("wing", yValue.size() + "");

		// 构建一个LineDataSet 代表一组Y轴数据 （比如不同的彩票： 七星彩 双色球）
		//
		// dataSet2 = new LineDataSet(yValue1, "七星彩");
		// dataSet2.setCircleSize(4);
		// dataSet2.setCircleColor(Color.BLUE);
		// dataSet2.setDrawCircleHole(false);
		// dataSet2.setValueTextSize(0);
		// dataSet2.setLineWidth(2);
		// dataSet2.setColor(Color.BLACK);// 设置颜色
		// dataSet2.setFillColor(Color.BLUE);
		dataSets = new ArrayList<LineDataSet>();

		// 将数据加入dataSets
		dataSets.add(dataSet1);
		// dataSets.add(dataSet2);

		// 构建一个LineData 将dataSets放入
		LineData lineData = new LineData(xValues, dataSets);

		// mLineChart2.setBackgroundColor(Color.BLUE);
		chart.setGridBackgroundColor(Color.WHITE);
		// 将数据插入
		chart.setData(lineData);

		Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
		mLegend.setXEntrySpace(7f);
		mLegend.setYEntrySpace(5f);
		mLegend.setForm(LegendForm.SQUARE);// 样式
		mLegend.setFormSize(0f);// 字体
		mLegend.setTextColor(Color.WHITE);// 颜色

		chart.animateX(0); // 立即执行的动画,x轴
	}

	@Override
	public void initInformation() {
		// TODO Auto-generated method stub

	}

	// 设置actionBar
	public void setActionBar() {
		Button leftfirstBtn, leftsecondBtn, leftThirdBtn, leftForthBtn, leftFifthBtn, leftSixthBtn, leftSevenThBtn,
				leftEighthBtn, leftNinethBtn, leftTenth_btn;
		// TextView title;

		String ExperimentType = contextString.subSequence(contextString.indexOf("ExperimentType:") + 15,
				contextString.indexOf(",SampleType:")) + "";
		leftfirstBtn = BindView(R.id.leftfirst_btn);
		leftfirstBtn.setVisibility(View.VISIBLE);
		leftsecondBtn = BindView(R.id.leftsecond_btn);
		leftsecondBtn.setVisibility(View.VISIBLE);
		leftThirdBtn = BindView(R.id.leftThird_btn);
		leftThirdBtn.setVisibility(View.VISIBLE);
		leftForthBtn = BindView(R.id.leftForth_btn);
		leftForthBtn.setVisibility(View.VISIBLE);
		leftFifthBtn = BindView(R.id.leftFifth_btn);
		leftFifthBtn.setVisibility(View.VISIBLE);
		leftSixthBtn = BindView(R.id.leftSixth_btn);
		leftSixthBtn.setVisibility(View.VISIBLE);
		leftSevenThBtn = BindView(R.id.leftSevenTh_btn);
		leftSevenThBtn.setVisibility(View.VISIBLE);
		leftEighthBtn = BindView(R.id.leftEighth_btn);
		leftEighthBtn.setVisibility(View.VISIBLE);
		leftNinethBtn = BindView(R.id.leftNineth_btn);
		leftNinethBtn.setVisibility(View.VISIBLE);

		if (ExperimentType.equals("绝对定量") || ExperimentType.equals("Absolute Quantitation")) {
			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.INVISIBLE);

			leftThirdBtn.setSelected(true);

			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_standarad);
			leftForthBtn.setText(R.string.ana_multiplot);
			leftFifthBtn.setText(R.string.ana_rawdata);
			leftSixthBtn.setText(R.string.ana_meltcurve);
			leftSevenThBtn.setText(R.string.ana_result);
			leftEighthBtn.setText(R.string.ana_report);
			leftNinethBtn.setText(R.string.ana_analysissetting);

			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					// pd =
					// ProgressDialog.show(AnalyzeStandardCurveActivity.this,
					// "", "loading...", true, true);
					//
					// new Thread() {
					// public void run() {
					// try {
					// Intent intent = new Intent(
					// AnalyzeStandardCurveActivity.this,
					// AnalyzeStandardCurveActivity.class);
					// startActivity(intent);
					//
					// } finally {
					// messageListener
					// .sendEmptyMessage(TASK_LOOP_COMPLETE);
					// }
					// }
					// }.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeMulticomponentPlotActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});

		} else if (ExperimentType.equals("标准曲线相对定量") || ExperimentType.equals("Standard Curve Relative Quantitation")) {

			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.VISIBLE);
			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.VISIBLE);

			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_standarad);
			leftForthBtn.setText(R.string.ana_multiplot);
			leftFifthBtn.setText(R.string.ana_rawdata);
			leftSixthBtn.setText(R.string.ana_meltcurve);
			leftSevenThBtn.setText(R.string.ana_rela_quan);
			leftEighthBtn.setText(R.string.ana_result);
			leftNinethBtn.setText(R.string.ana_report);
			leftTenth_btn.setText(R.string.ana_analysissetting);

			leftThirdBtn.setSelected(true);
			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					// System.gc();
					// pd =
					// ProgressDialog.show(AnalyzeStandardCurveActivity.this,
					// "", "loading...", true, true);
					//
					// new Thread() {
					// public void run() {
					// try {
					// Intent intent = new Intent(
					// AnalyzeStandardCurveActivity.this,
					// AnalyzeStandardCurveActivity.class);
					// startActivity(intent);
					// finish();
					// } finally {
					// messageListener
					// .sendEmptyMessage(TASK_LOOP_COMPLETE);
					// }
					// }
					// }.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeMulticomponentPlotActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeRelativeQuanticationActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftTenth_btn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
		} else if (ExperimentType.equals("比较ct值相对定量") || ExperimentType.equals("⊿Ct Relative Quantitation")) {

			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.VISIBLE);

			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_standarad);
			leftForthBtn.setText(R.string.ana_rawdata);
			leftFifthBtn.setText(R.string.ana_meltcurve);
			leftSixthBtn.setText(R.string.ana_rela_quan);
			leftSevenThBtn.setText(R.string.ana_result);
			leftEighthBtn.setText(R.string.ana_report);
			leftNinethBtn.setText(R.string.ana_analysissetting);

			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					// System.gc();
					// pd =
					// ProgressDialog.show(AnalyzeStandardCurveActivity.this,
					// "", "loading...", true, true);
					//
					// new Thread() {
					// public void run() {
					// try {
					// Intent intent = new Intent(
					// AnalyzeStandardCurveActivity.this,
					// AnalyzeMulticomponentPlotActivity.class);
					// startActivity(intent);
					// finish();
					// } finally {
					// messageListener
					// .sendEmptyMessage(TASK_LOOP_COMPLETE);
					// }
					// }
					// }.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeRelativeQuanticationActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftTenth_btn.setVisibility(View.INVISIBLE);

		}

		leftfirstBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				System.gc();
				// pd = ProgressDialog.show(this, "", "loading...", true, true);
				pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							BaseApplication.getInstance().finishAll();
							Intent intent = new Intent(AnalyzeStandardCurveActivity.this, MainMenuActivity.class);
							startActivity(intent);
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();
				finish();

			}
		});
		leftsecondBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				System.gc();
				pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
									AnalyzeAmplificationplotActivity.class);
							startActivity(intent);
							finish();
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();
			}
		});
		
		Boolean noRongJie=false;
		for(int i= 0; i<activityMethodBeans.size();i++){
			if(!TextUtils.isEmpty(activityMethodBeans.get(i).getDeltaT())){
				noRongJie=true;
			}
		}
		if(noRongJie){
			 if (getText(R.string.ana_meltcurve).equals(leftFifthBtn.getText())) {
				 leftFifthBtn.setVisibility(View.GONE);
			}else if (getText(R.string.ana_meltcurve).equals(leftSixthBtn.getText())) {
				leftSixthBtn.setVisibility(View.GONE);
			}
		}

	}

	// 获取当前时间的方法
	public void setSystemTime() {

		TextView date, fileName;
		date = BindView(R.id.date);
		fileName = BindView(R.id.file_name);

		// 获取系统时间
		SimpleDateFormat sdfDate = new SimpleDateFormat("MM dd,yyyy");
		date.setText(sdfDate.format(new Date()));

		// 文件路径置空
		fileName.setText(SharedPreferencesUtils.get(this, BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "/"
				+ SharedPreferencesUtils.get(this, BaseApplication.FILEMANGER_PREPAREFILENAME, ""));

	}

	// 设置bottom布局
	public void setBottomView() {
		Button bottomLeftFistBtn, bottomCenterBtn, bottomRightBtn;

		bottomLeftFistBtn = BindView(R.id.bottomLeftFistBtn);
		bottomCenterBtn = BindView(R.id.bottomCenterBtn);
		bottomRightBtn = BindView(R.id.bottomRightBtn);

		bottomLeftFistBtn.setVisibility(View.VISIBLE);
		// bottomCenterBtn.setVisibility(View.VISIBLE);
		bottomRightBtn.setVisibility(View.VISIBLE);

		bottomLeftFistBtn.setText(R.string.bottomView_back);
		// TODO 这个button的文字不确定暂时用A代替
		bottomCenterBtn.setText("A"); // 不确定！！！！！！！
		bottomRightBtn.setText(R.string.bottomView_next);

		bottomLeftFistBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// ByAlert.alert("back");
				pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
									AnalyzeAmplificationplotActivity.class);
							// intent.putStringArrayListExtra("data_list1",
							// data_list1);s
							startActivity(intent);
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();
				finish();

			}
		});

		bottomCenterBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				ByAlert.alert("A");

			}
		});
		bottomRightBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				System.gc();
				pd = ProgressDialog.show(AnalyzeStandardCurveActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
									AnalyzeMulticomponentPlotActivity.class);
							// intent.putStringArrayListExtra("data_list1",
							// data_list1);
							startActivity(intent);
							finish();
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();

			}
		});
	}

	// menu的弹出窗口
	private void showMenuPopupWindow(View v) {

		if (null == menuPopupWindow || !menuPopupWindow.isShowing()) {
			View contentView = LayoutInflater.from(this).inflate(R.layout.fragment_run_menu, null);

			menuPopupWindow = new PopupWindow(contentView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			menuPopupWindow.setBackgroundDrawable(new BitmapDrawable());
			menuPopupWindow.setTouchable(true);
			menuPopupWindow.setOutsideTouchable(true);
			menuPopupWindow.showAsDropDown(v, -40, -3);

			TextView amplificationTv, temperatureTv, methodTv;
			amplificationTv = (TextView) contentView.findViewById(R.id.amplificationTv);
			temperatureTv = (TextView) contentView.findViewById(R.id.temperatureTv);
			methodTv = (TextView) contentView.findViewById(R.id.methodTv);

			amplificationTv.setBackground(getResources().getDrawable(R.color.darkBlue));
			amplificationTv.setTextColor(this.getResources().getColor(R.color.white));
			temperatureTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					menuPopupWindow.dismiss();
					Intent intent = new Intent(AnalyzeStandardCurveActivity.this, TemparetureActivity.class);
					startActivity(intent);

				}
			});
			methodTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					// Intent intent =new Intent(BaseInformationActivity, uri)
					menuPopupWindow.dismiss();
					Intent intent = new Intent(AnalyzeStandardCurveActivity.this,
							AnalyzeMulticomponentPlotActivity.class);
					startActivity(intent);
				}
			});

		} else {
			menuPopupWindow.dismiss();
			menuboo = !menuboo;
		}

	}

	private void getInfo() {

		//
		folderName = SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this,
				BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "";
		fileName = SharedPreferencesUtils.get(AnalyzeStandardCurveActivity.this,
				BaseApplication.FILEMANGER_PREPAREFILENAME, "") + "";

		String path = appFilePath + "/" + folderName;

		File file = new File(path + "/" + fileName);

		FileInputStream in = null;
		BufferedReader reader = null;
		contextString = new StringBuffer();
		try {
			in = new FileInputStream(file);
			reader = new BufferedReader(new InputStreamReader(in));
			String line = "";
			while ((line = reader.readLine()) != null) {
				contextString.append(line);
				contextString.append(",");
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (Exception e2) {
					e2.printStackTrace();
				}
			}
		}

		// BufferedReader reader = null;
		// contextString = new StringBuffer();
		// System.gc();
		// try {
		// System.out.println("以行为单位读取文件内容，一次读一整行:");
		// reader = new BufferedReader(new FileReader(file));
		// String tempString = null;
		// int line = 1;
		// // 一次读入一行，直到读入null为文件结束
		// while ((tempString = reader.readLine()) != null) {
		// // 显示行号
		// // System.out.println("line " + line + ": " + tempString);
		// // Log.e("--", tempString);
		// contextString.append(tempString);
		// contextString.append(",");
		// line++;
		// }
		// reader.close();
		// } catch (IOException e) {
		// e.printStackTrace();
		// } finally {
		// if (reader != null) {
		// try {
		// reader.close();
		// // LogUtil.e("!!", contextString + "");
		//
		// } catch (IOException e1) {
		// }
		// }
		// }

	}

	private Handler messageListener = new Handler() {
		public void handleMessage(Message msg) {
			switch (msg.arg1) {
			case TASK_LOOP_COMPLETE:
				try {
					pd.dismiss();
				} catch (Exception e) {
					// TODO: handle exception
				}

				break;

			}
		}
	};

	public class DragGridViewAdapter extends BaseAdapter {
		List<HashMap<String, Object>> dataSourceListBlock = new ArrayList<HashMap<String, Object>>();

		public DragGridViewAdapter(List<HashMap<String, Object>> dataSourceListBlock) {
			super();
			this.dataSourceListBlock = dataSourceListBlock;
		}

		public void changeList(List<HashMap<String, Object>> dataSourceListBlock) {

			this.dataSourceListBlock = dataSourceListBlock;
			notifyDataSetChanged();
		}

		class ViewHolder {

			LinearLayout line, textViewLine;
			ImageView item_image;
			TextView item_text, aisle1, aisle2, aisle3, aisle4;

		}

		@Override
		public int getCount() {
			return dataSourceListBlock != null ? dataSourceListBlock.size() : 0;
		}

		@Override
		public Object getItem(int position) {
			return dataSourceListBlock != null ? dataSourceListBlock.get(position) : null;
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			final ViewHolder holder;
			if (convertView == null) {
				holder = new ViewHolder();
				convertView = LayoutInflater.from(AnalyzeStandardCurveActivity.this).inflate(R.layout.item_layout2_grid,
						null);

				holder.line = (LinearLayout) convertView.findViewById(R.id.line);
				holder.item_image = (ImageView) convertView.findViewById(R.id.item_image);
				holder.item_text = (TextView) convertView.findViewById(R.id.item_text);
				holder.aisle1 = (TextView) convertView.findViewById(R.id.aisle1);
				holder.aisle2 = (TextView) convertView.findViewById(R.id.aisle2);
				holder.aisle3 = (TextView) convertView.findViewById(R.id.aisle3);
				holder.aisle4 = (TextView) convertView.findViewById(R.id.aisle4);
				holder.textViewLine = (LinearLayout) convertView.findViewById(R.id.textViewLine);

				convertView.setTag(holder);
			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.aisle1.setVisibility(View.VISIBLE);
			holder.aisle2.setVisibility(View.VISIBLE);
			holder.aisle3.setVisibility(View.VISIBLE);
			holder.aisle4.setVisibility(View.VISIBLE);
			holder.textViewLine.setBackground(getResources().getDrawable(R.color.darkBlue));

			if (dataSourceListBlock.get(position).get("item_aisle") != null) {
				if (!TextUtils.isEmpty(dataSourceListBlock.get(position).get("item_aisle") + "")) {

					if (Integer.parseInt(dataSourceListBlock.get(position).get("item_aisle").toString()) != 0) {
						int aisleNum = (Integer) dataSourceListBlock.get(position).get("item_aisle");
						holder.textViewLine.setVisibility(View.VISIBLE);
						holder.aisle1.setVisibility(View.VISIBLE);
						holder.aisle2.setVisibility(View.VISIBLE);
						holder.aisle3.setVisibility(View.VISIBLE);
						holder.aisle4.setVisibility(View.VISIBLE);
						switch (aisleNum) {
						case 1:
							setcolor(holder.aisle1, position, holder.textViewLine);
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));

							break;
						case 2:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle2, position, holder.textViewLine);
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));

							break;

						case 3:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle3, position, holder.textViewLine);
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));
							break;

						case 4:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle4, position, holder.textViewLine);
							break;

						default:
							break;
						}
					} else {
						holder.textViewLine.setVisibility(View.INVISIBLE);
						holder.aisle1.setVisibility(View.INVISIBLE);
						holder.aisle2.setVisibility(View.INVISIBLE);
						holder.aisle3.setVisibility(View.INVISIBLE);
						holder.aisle4.setVisibility(View.INVISIBLE);
					}

				} else {
					holder.textViewLine.setVisibility(View.INVISIBLE);
					holder.aisle1.setVisibility(View.INVISIBLE);
					holder.aisle2.setVisibility(View.INVISIBLE);
					holder.aisle3.setVisibility(View.INVISIBLE);
					holder.aisle4.setVisibility(View.INVISIBLE);
				}
			}

			holder.line.setBackground(getResources().getDrawable(R.color.white));
			if (dataSourceListBlock.get(position).get("item_selected") != null) {

				if ((Boolean) dataSourceListBlock.get(position).get("item_selected")) {
					holder.line.setBackground(getResources().getDrawable(R.color.darkBlue));
				} else {
					holder.line.setBackground(getResources().getDrawable(R.color.white));
				}

			} else {
				holder.line.setBackground(getResources().getDrawable(R.color.white));
			}

			// map.put("item_type", "positive");

			if ("sample".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#ff2d55"));
			} else if ("standard".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#fd9727"));
			} else if ("positive".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#ff00a9"));
			} else if ("negative".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#159588"));
			} else if (dataSourceListBlock.get(position).get("item_image") == null) {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			} else if ("".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			} else {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			}

			// if
			// ("".equals(dataSourceListBlock.get(position).get("item_image")))
			// {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.white));
			// } else if ("11".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_one));
			// } else if ("12".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_two));
			// } else if ("13".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_three));
			// } else if ("14".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_four));
			// } else if ("15".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_five));
			// } else if ("16".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_six));
			// } else if ("21".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_one));
			// } else if ("22".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_two));
			// } else if ("23".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_three));
			// } else if ("24".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_four));
			// } else if ("25".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_five));
			// } else if ("26".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_six));
			// } else if ("31".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_one));
			// } else if ("32".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_two));
			// } else if ("33".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_three));
			// } else if ("34".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_four));
			// } else if ("35".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_five));
			// } else if ("36".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_six));
			// } else if ("41".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_one));
			// } else if ("42".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_two));
			// } else if ("43".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_three));
			// } else if ("44".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_four));
			// } else if ("45".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_five));
			// } else if ("46".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_six));
			// } else if ("51".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_one));
			// } else if ("52".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_two));
			// } else if ("53".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_three));
			// } else if ("54".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_four));
			// } else if ("55".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_five));
			// } else if ("56".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_six));
			// } else if ("61".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_one));
			// } else if ("62".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_two));
			// } else if ("63".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_three));
			// } else if ("64".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_four));
			// } else if ("65".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_five));
			// } else if ("66".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_six));
			// }
			holder.item_text.setText(dataSourceListBlock.get(position).get("item_text") + "");

			return convertView;
		}

		private void setcolor(TextView aisle, int position, LinearLayout textViewLine) {
			if ("".equals(dataSourceListBlock.get(position).get("item_image").toString().trim())) {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);
				textViewLine.setBackground(getResources().getDrawable(R.color.white));
			} else if ("11".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_one));
			} else if ("12".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_two));
			} else if ("13".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_three));
			} else if ("14".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_four));
			} else if ("15".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_five));
			} else if ("16".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_six));
			} else if ("21".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_one));
			} else if ("22".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_two));
			} else if ("23".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_three));
			} else if ("24".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_four));
			} else if ("25".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_five));
			} else if ("26".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_six));
			} else if ("31".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_one));
			} else if ("32".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_two));
			} else if ("33".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_three));
			} else if ("34".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_four));
			} else if ("35".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_five));
			} else if ("36".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_six));
			} else if ("41".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_one));
			} else if ("42".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_two));
			} else if ("43".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_three));
			} else if ("44".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_four));
			} else if ("45".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_five));
			} else if ("46".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_six));
			} else if ("51".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_one));
			} else if ("52".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_two));
			} else if ("53".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_three));
			} else if ("54".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_four));
			} else if ("55".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_five));
			} else if ("56".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_six));
			} else if ("61".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_one));
			} else if ("62".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_two));
			} else if ("63".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_three));
			} else if ("64".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_four));
			} else if ("65".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_five));
			} else if ("66".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_six));
			} else if (dataSourceListBlock.get(position).get("item_image") == null) {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);

			} else {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);
				aisle.setBackground(getResources().getDrawable(R.color.white));
			}

		}
	}

	public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {
		public ArrayList<StandCurveBean> datas = new ArrayList<StandCurveBean>();

		public MyAdapter(ArrayList<StandCurveBean> datas) {
			super();
			this.datas = datas;
		}

		// 创建新View，被LayoutManager所调用
		@Override
		public MyViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
			View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_analyze_standcurve_target,
					viewGroup, false);
			MyViewHolder vh = new MyViewHolder(view);
			return vh;
		}

		// 将数据与界面进行绑定的操作
		@Override
		public void onBindViewHolder(MyViewHolder viewHolder, int position) {
			viewHolder.targetName.setText(datas.get(position).getTargetName());
			viewHolder.slopeTv.setText(datas.get(position).getSlope());
			viewHolder.Y_interTv.setText(datas.get(position).getyInter());
			viewHolder.R2Tv.setText(datas.get(position).getR2());
			viewHolder.EFFTV.setText(datas.get(position).getEffString());

			for (int i = 0; i < activityLayoutTableBeans.size(); i++) {
				if (datas.get(position).getTargetName().equals(activityLayoutTableBeans.get(i).getTarget())) {
					viewHolder.targetName.setTextColor(
							getResources().getColor(getcolor(activityLayoutTableBeans.get(i).getColor() + "")));
				}
			}
		}

		// 获取数据的数量
		@Override
		public int getItemCount() {
			return datas.size();
		}

		// 自定义的ViewHolder，持有每个Item的的所有界面元素
		public class MyViewHolder extends RecyclerView.ViewHolder {
			public TextView targetName;
			public TextView slopeTv;
			public TextView Y_interTv;
			public TextView R2Tv;
			public TextView EFFTV;

			public MyViewHolder(View view) {
				super(view);
				targetName = (TextView) view.findViewById(R.id.targetName);
				slopeTv = (TextView) view.findViewById(R.id.slopeTv);
				Y_interTv = (TextView) view.findViewById(R.id.Y_interTv);
				R2Tv = (TextView) view.findViewById(R.id.R2Tv);
				EFFTV = (TextView) view.findViewById(R.id.EFFTV);
			}
		}
	}

	private int getcolor(String colorString) {
		switch (Integer.parseInt(colorString)) {
		case 11:
			return R.color.palette_one_one;

		case 12:

			return R.color.palette_one_two;
		case 13:

			return R.color.palette_one_three;
		case 14:

			return R.color.palette_one_four;
		case 15:

			return R.color.palette_one_five;
		case 16:

			return R.color.palette_one_six;
		case 21:

			return R.color.palette_two_one;
		case 22:

			return R.color.palette_two_two;
		case 23:

			return R.color.palette_two_three;
		case 24:

			return R.color.palette_two_four;
		case 25:

			return R.color.palette_two_five;
		case 26:

			return R.color.palette_two_six;
		case 31:
			return R.color.palette_three_one;
		case 32:

			return R.color.palette_three_two;
		case 33:

			return R.color.palette_three_three;
		case 34:

			return R.color.palette_three_four;
		case 35:

			return R.color.palette_three_five;
		case 36:

			return R.color.palette_three_six;
		case 41:
			return R.color.palette_four_one;

		case 42:

			return R.color.palette_four_two;
		case 43:

			return R.color.palette_four_three;
		case 44:

			return R.color.palette_four_four;
		case 45:

			return R.color.palette_four_five;
		case 46:

			return R.color.palette_four_six;
		case 51:

			return R.color.palette_five_one;
		case 52:

			return R.color.palette_five_two;
		case 53:

			return R.color.palette_five_three;
		case 54:

			return R.color.palette_five_four;
		case 55:

			return R.color.palette_five_five;
		case 56:

			return R.color.palette_five_six;
		case 61:

			return R.color.palette_six_one;
		case 62:

			return R.color.palette_six_two;
		case 63:

			return R.color.palette_six_three;
		case 64:

			return R.color.palette_six_four;
		case 65:

			return R.color.palette_six_five;
		case 66:

			return R.color.palette_six_six;

		default:
			return 0;
		}

	}

	public static void removeDuplicateWithOrder(List list) {
		Set set = new HashSet();
		List newList = new ArrayList();
		for (Iterator iter = list.iterator(); iter.hasNext();) {
			Object element = iter.next();
			if (set.add(element))
				newList.add(element);
		}
		list.clear();
		list.addAll(newList);
	}
}
